import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@Entity("article_category", { schema: "alumni" })
export class ArticleCategory {
  @PrimaryGeneratedColumn({ type: "int", name: "id", unsigned: true })
  id: number;

  @Column("varchar", { name: "name", length: 50, default: () => "'名称'" })
  name: string;

  @Column("varchar", { name: "icon", comment: "图标", length: 100 })
  icon: string;

  @Column("int", { name: "parent_id", default: () => "'0'" })
  parentId: number;

  @Column("int", {
    name: "top_id",
    comment: "最顶级id",
    unsigned: true,
    default: () => "'0'",
  })
  topId: number;

  @Column("varchar", { name: "code", length: 20 })
  code: string;

  @Column("int", { name: "level", unsigned: true, default: () => "'0'" })
  level: number;

  @Column("int", {
    name: "sort",
    comment: "排序越大越靠前",
    default: () => "'0'",
  })
  sort: number;

  @Column("tinyint", { name: "enable", width: 1, default: () => "'0'" })
  enable: boolean;

  @Column("int", {
    name: "creator_id",
    comment: "创建人",
    unsigned: true,
    default: () => "'0'",
  })
  creatorId: number;

  @Column("varchar", {
    name: "remark",
    nullable: true,
    comment: "备注",
    length: 100,
  })
  remark: string | null;

  @Column("int", { name: "create_time", unsigned: true, default: () => "'0'" })
  createTime: number;

  @Column("int", { name: "update_time", unsigned: true, default: () => "'0'" })
  updateTime: number;
}
